package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * 对象输出流测试
 */
public class ObjectOutPutStreamTest {
    public static void main(String[] args) {
        writeObject();
    }

    private static void writeObject() {
        try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/Users/luchuan/IdeaProjects/java-test/person.txt"))) {
            oos.writeObject(new Person("小明",18));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
